Repository navigation
feat: HCL scenario schema, function allowlist, parser fuzz target - #1
Merged
Merged
Conversation
First piece of the automation layer (go-webengine/engine's own plan at
~/.claude/plans/federated-nibbling-pixel.md): a scenario file is a
declarative sequence of click/fill/assert/submit steps, plus an
optional pinned-page identity check.
- hclscenario/functions.go: the function allowlist (upper/lower/trim/
join) — a small, fixed, reviewed set per go-wasmcontainers' own
security note (the allowlist IS the attack surface): no file/exec/
network/env functions, nothing unbounded, cty's own stdlib
deliberately NOT imported wholesale.
- hclscenario/schema.go: Parse() — hclsyntax parsing, schema
validation, function-call evaluation. Read hashicorp/hcl/v2's own
EvalContext/function.Spec docs before writing this (bibliography
first), not reconstructed from memory.
- FuzzParseScenario found a real panic on its first real run
(go test -fuzz, ~11M execs clean after the fix): calling
cty.Value.AsString() without checking the value's actual type first
crashes on any non-string attribute (e.g. `url = {}`). Fixed with a
shared evalString helper that validates known/non-null/string before
ever calling AsString, used at every evaluation site. The crashing
input is kept as a permanent regression entry
(testdata/fuzz/FuzzParseScenario/4941ee77dd913a51).
Not yet implemented: the driver/CLI wiring and the session/dry-run/
pin-enforcement/audit-log/bounds/anti-bot guardrails — tracked
separately, this PR is the scenario format only.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First piece of the automation layer (go-webengine/engine's own plan,
~/.claude/plans/federated-nibbling-pixel.md): the HCL scenario format, before any driver/CLI wiring.hclscenario/functions.go: the function allowlist (upper/lower/trim/join) — a small, fixed, reviewed set per go-wasmcontainers' own security note (the allowlist IS the attack surface): no file/exec/network/env functions, nothing unbounded, cty's own stdlib deliberately not imported wholesale.hclscenario/schema.go:Parse()— readhashicorp/hcl/v2's ownEvalContext/function.Specdocs before writing this (bibliography first), not reconstructed from memory.FuzzParseScenariofound a real panic on its first real run (go test -fuzz, ~11M execs clean after the fix): callingcty.Value.AsString()without checking the value's actual type first crashes on any non-string attribute (e.g.url = {}). Fixed with a sharedevalStringhelper that validates known/non-null/string before ever callingAsString, used at every evaluation site. The crashing input is kept as a permanent regression entry.Not yet implemented: the driver/CLI wiring and the session/dry-run/pin-enforcement/audit-log/bounds/anti-bot guardrails — tracked separately in the plan file, this PR is the scenario format only.
Test plan
upper/lower/trim/join) plus a guard test asserting the allowlist has exactly these four entriesscenarioblock, missing required attributes, unrecognized step kind, unregistered function call, empty/truncated sourceFuzzParseScenario: seeded, run as regular tests, then a real-fuzzpass (~11M execs, clean) — found and fixed theAsStringpanic abovego build/go vet/gofmt -l/govulncheck ./...cleango test ./...green🤖 Generated with Claude Code